﻿using System;

class EncryptionKey
{
    static void Main()
    {
        //Example 7.
        //Write a program that encodes and decodes a string using given encryption key (cipher). The key consists of a sequence of 
        //characters. The encoding/decoding is done by performing XOR (exclusive or) operation over the first letter of the string 
        //with the first of the key, the second – with the second, etc. When the last key character is reached, the next is the first.

        //Примерен текст: "Nakov". Примерен шифър: "ab". Примерен резултат: "\u002f\u0003\u000a\u000d\u0017".

        string text = "Nakov";
        string cipher = "ab";
        int cipherLength = cipher.Length;
        int result;
        for (int i = 0; i < text.Length; i++)
        {
            result = text[i] ^ cipher[i % cipherLength];
            Console.Write(@"\u{0:x4}", result);
        }
        Console.WriteLine();
    }
}

